package com.example.administrator.myapplication;

import android.app.Activity;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class CurriculumInfoActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_curriculum_info);
        ListView listView = (ListView) findViewById(R.id.curriculum_day_list);
        listView.setAdapter(new CurriculumListAdapter(getApplicationContext(), getData()));
    }

    public List<Object> getData() {
        List<Object> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add("asdfasdf");
        }
        return list;
    }

    class CurriculumListAdapter extends BaseAdapter {

        private List<Object> data;
        private LayoutInflater layoutInflater;

        public CurriculumListAdapter(Context context, List<Object> data) {
            this.layoutInflater = LayoutInflater.from(context);
            this.data = data;
        }

        @Override
        public int getCount() {
            return data.size();
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = layoutInflater.inflate(R.layout.curriculum_day_item, null);
            }
            return convertView;
        }
    }

}
